package io.renren.modules.oa.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.modules.oa.dao.OaPlanConfigDao;
import io.renren.modules.oa.entity.OaPlanConfigEntity;
import io.renren.modules.oa.service.OaPlanConfigService;


@Service("oaPlanConfigService")
public class OaPlanConfigServiceImpl extends ServiceImpl<OaPlanConfigDao, OaPlanConfigEntity> implements OaPlanConfigService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<OaPlanConfigEntity> page = this.selectPage(
                new Query<OaPlanConfigEntity>(params).getPage(),
                new EntityWrapper<OaPlanConfigEntity>()
        );

        return new PageUtils(page);
    }

	@Override
	public OaPlanConfigEntity selectByMerchantId(Long merchantId) {
		return this.selectOne(new EntityWrapper<OaPlanConfigEntity>().eq("merchant_id", merchantId));
	}
    
	@Override
	public List<OaPlanConfigEntity> queryPlanConfigList() {
		return this.selectList(new EntityWrapper<OaPlanConfigEntity>()
				.orderBy("id", true));
	}

}
